import { post,get } from '@/api/request'
// 部门相关接口
export const deptApi={
    addUrl(url){
        return '/easbaseinfo/dept'+url
    },
    getdeptListTree(){
        return post(this.addUrl("/list"))
    },
    saveDept(data){
        return post(this.addUrl('/save'),data)
    },
    updateDept(data){
        return post(this.addUrl('/update'),data)
    },
    saveOrUpdate(data,status){
        if(status =='save'){
            return this.saveDept(data)
        }else if(status =='update'){
            return this.updateDept(data)
        }
    },
    deleteDept(data){
        return post(this.addUrl('/delete'),data)
    },
    getDeptInfo(id){
        return get(this.addUrl('/info/'+id))
    },


}
// 专业相关接口
export const majorApi = {
    addUrl(url){
        return '/easbaseinfo/major'+url
    },
    listMajor(data){
        return post(this.addUrl('/list'),data)
    },
    listMajorNoPage(data){
        return post(this.addUrl('/listnopage'),data)
    },
    deleteMajor(data){
        return post(this.addUrl('/delete'),data)
    },
    saveMajor(data){
        return post(this.addUrl('/save'),data)
    },
    updateMajor(data){
        return post(this.addUrl('/update'),data)
    },
    saveOrUpdate(data,status){
        if(status =='save'){
            return this.saveMajor(data)
        }else if(status =='update'){
            return this.updateMajor(data)
        }
    },
    getMajorInfo(id){
        return get(this.addUrl('/info/'+id))
    }
}
// 班级相关接口
export const classApi = {
    addUrl(url){
        return '/easbaseinfo/class'+url
    },
    getClassInfo(id){
        return get(this.addUrl('/info/'+id))
    },
    listClassNoPage(data){
        return post(this.addUrl('/listnopage'),data)
    },
    listClass(data){
        return post(this.addUrl('/list'),data)
    },
    deleteClass(data){
        return post(this.addUrl('/delete'),data)
    },
    saveClass(data){
        return post(this.addUrl('/save'),data)
    },
    updateClass(data){
        return post(this.addUrl('/update'),data)
    },
    saveOrUpdate(data,status){
        if(status =='save'){
            return this.saveClass(data)
        }else if(status =='update'){
            return this.updateClass(data)
        }
    },
}

// 房间相关接口
export const roomApi = {
    addUrl(url){
        return '/easbaseinfo/room'+url
    },
    getRoomInfo(id){
        return get(this.addUrl('/info/'+id))
    },
    listRoomNoPage(data){
        return post(this.addUrl('/listnopage'),data)
    },
    listRoom(data){
        return post(this.addUrl('/list'),data)
    },
    listDormitory(data){
        return post(this.addUrl('/listdormitory'),data)
    },
    listClassroom(data){
        return post(this.addUrl('/listclassroom'),data)
    },
    listClassroomNoPage(data){
        return post(this.addUrl('/listclassroomnopage'),data)
    },
    listbuild(){
        return post(this.addUrl('/listbuild'))
    },
    deleteRoom(data){
        return post(this.addUrl('/delete'),data)
    },
    saveRoom(data){
        return post(this.addUrl('/save'),data)
    },
    updateRoom(data){
        return post(this.addUrl('/update'),data)
    },
    saveOrUpdate(data,status){
        if(status =='save'){
            return this.saveRoom(data)
        }else if(status =='update'){
            return this.updateRoom(data)
        }
    },
}